<?php
require_once("init.php");
require_once("inc/header.php");
$msg=$_POST['msg'];
$msg=common_replace($msg);
$url="http://img.ly/api/uploadAndPost";
$post_data = array("media"=>"@".$_FILES['file']['tmp_name'],
        "message"=>$msg,
        "username"=>USER,
        "password"=>PASS);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_USERPWD, USER_PASS);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, USERAGENT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_exec($ch);
curl_close($ch);
header("Location: index.php");
?>